
const routes = createRoutesFromFiles(require.context('../', true, /childrenRouter\.js/))

function createRoutesFromFiles (routeFiles) {
    let _routes = []

    let zz = /childrenRouter\.js/

    // 循环获取router配置
    routeFiles.keys().forEach(key => {
        //排除自身
        if (key === './index/router.js') return
        //排除二级router
        if (zz.test(key)) {
            let item = routeFiles(key).default  //读取文档中的default模块
            //数组对象循环添加
            if (item instanceof Array) item.forEach(route => _routes.push(route))
            else _routes.push(item)
        }
    })

    return _routes
}


export default [
    {
        path:  "/vip",
        name: 'vip',
        component: (resolve) => require(['./index.vue'], resolve),
        children: routes
    },
]
